/*
 *  Property Mapper, simple automatic GUI generator for JavaBeans using annotations.
 *  Copyright (C) 2008 Jon Lennersten, Johan Hedin
 *
 *  This file is part of Property Mapper.
 *
 *  Property Mapper is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Property Mapper is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Property Mapper.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.mawell.common.propertymapperswing.demo;

import com.mawell.common.propertymapper.*;

import java.util.*;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;


@PropertyConfigurable
public class PropertyObject {

    String stringWithoutDescription;
    String mandatoryString;
    String stringWithPossibleValues;
    String stringContainingId;
    String mandatoryStringContainingId;
    boolean booleanWithDescription = false;
    int integerWithTranslation;
    Date date;
    Map map = new HashMap();
    Map mapKeyIsId = new HashMap();
    Map mapKeyIsEnumValueIsId = new HashMap();
    List list = new ArrayList();
    List listValueIsId = new ArrayList();
    List listValueIsEnum = new ArrayList();
    ExampleEnum enumProperty;
    ChildObject child = new ChildObject();


    @Property
    public String getStringWithoutDescription() {
        return stringWithoutDescription;
    }

    public void setStringWithoutDescription(String stringWithoutDescription) {
        this.stringWithoutDescription = stringWithoutDescription;
    }

    @Property(mandatory = true)
    public String getMandatoryString() {
        return mandatoryString;
    }

    public void setMandatoryString(String mandatoryString) {
        this.mandatoryString = mandatoryString;
    }

    @Property
    @PossibleValues(possibleValues = {"Value A", "Value B", "Value C"})
    public String getStringWithPossibleValues() {
        return stringWithPossibleValues;
    }

    public void setStringWithPossibleValues(String stringWithPossibleValues) {
        this.stringWithPossibleValues = stringWithPossibleValues;
    }

    @Property
    @ValueIsID(entity = "com.mawell.common.propertymapperswing.demo.ExampleEntity", nameField = "name")
    public String getStringContainingId() {
        return stringContainingId;
    }

    public void setStringContainingId(String stringContainingId) {
        this.stringContainingId = stringContainingId;
    }

    @Property(mandatory = true)
    @ValueIsID(entity = "com.mawell.common.propertymapperswing.demo.ExampleEntity", nameField = "name")
    public String getMandatoryStringContainingId() {
        return mandatoryStringContainingId;
    }

    public void setMandatoryStringContainingId(String mandatoryStringContainingId) {
        this.mandatoryStringContainingId = mandatoryStringContainingId;
    }

    @Property(description = "Boolean with description string")
    public boolean isBooleanWithDescription() {
        return booleanWithDescription;
    }

    public void setBooleanWithDescription(boolean booleanWithDescription) {
        this.booleanWithDescription = booleanWithDescription;
    }

    @Property(descriptionMethodName = "getIntegerLabel")
    public int getIntegerWithTranslation() {
        return integerWithTranslation;
    }

    public void setIntegerWithTranslation(int integerWithTranslation) {
        this.integerWithTranslation = integerWithTranslation;
    }

    @Property
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Property
    public Map getMap() {
        return map;
    }

    public void setMap(Map map) {
        this.map = map;
    }

    @Property
    @KeyIsID(entity = "com.mawell.common.propertymapperswing.demo.ExampleEntity", nameField = "name")
    public Map getMapKeyIsId() {
        return mapKeyIsId;
    }

    public void setMapKeyIsId(Map mapKeyIsId) {
        this.mapKeyIsId = mapKeyIsId;
    }

    @Property
    @KeyIsEnum(enumClass = "com.mawell.common.propertymapperswing.demo.ExampleEnum")
    @ValueIsID(entity = "com.mawell.common.propertymapperswing.demo.ExampleEntity", nameField = "name")
    public Map getMapKeyIsEnumValueIsId() {
        return mapKeyIsEnumValueIsId;
    }

    public void setMapKeyIsEnumValueIsId(Map mapKeyIsEnumValueIsId) {
        this.mapKeyIsEnumValueIsId = mapKeyIsEnumValueIsId;
    }

    @Property
    public List getList() {
        return list;
    }

     public void setList(List list) {
        this.list = list;
    }

    @Property
    @ValueIsID(entity = "com.mawell.common.propertymapperswing.demo.ExampleEntity", nameField = "name")
    public List getListValueIsId() {
        return listValueIsId;
    }

    public void setListValueIsId(List listValueIsId) {
        this.listValueIsId = listValueIsId;
    }

    @Property
    @ValueIsEnum(enumClass = "com.mawell.common.propertymapperswing.demo.ExampleEnum")
    public List getListValueisEnum() {
        return listValueIsEnum;
    }

    public void setListValueisEnum(List listValueisEnum) {
        this.listValueIsEnum = listValueisEnum;
    }

    @Property
    public ExampleEnum getEnumProperty() {
        return enumProperty;
    }

    public void setEnumProperty(ExampleEnum enumProperty) {
        this.enumProperty = enumProperty;
    }

    @Property
    public ChildObject getChild() {
        return child;
    }

    public void setChild(ChildObject child) {
        this.child = child;
    }

    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }
}
